<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
    <script>
        let [m,n] = [3,5]   
let time = [8, 4, 3, 2, 10]  
const liu = (m,n,time) => {
  let map = new Map();
  let arr = [0,0,0]
  time.sort((a,b) => {
    return a-b;
  })
  while(time.length >0){
    for(let i = 0;i<n;i++){
      let cur = time.shift()
      if(cur){
        arr[i] += Number(cur);
      }
    }
  }
  console.log(arr)
}  
liu(m,n,time)
    </script>
</body>
</html>